home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
dskut
/
passwrd9.zip
/
PASSWORD.ASM
< prev
next >
Wrap
Assembly Source File
|
1989-03-15
|
17KB
|
575 lines
Title pw9.asm
;Originally titled PW.8
;Rev by John R. Petrocelli 02/25/85
;Rev by John R. Petrocelli 04/30/85
;Rev by Durrell Drummond 10/10/86
;Re-written by Bob Montgomery 01/10/87
;Re-written by John Jaeger 03/12/89
;Major changes include ready for assembly by MASM.
;Use without the ANSI.SYS driver for reasonable CRT
;displays.
;Corrected source code. The original dated 01/10/87
;worked as stated when using the supplied object code,
;However when I added all the necessary items to compile
;with MASM, things didn't work so well. That may be due
;to the fact I am not acquainted with A86!
;Coding of the ASCII Password string so that if
;viewed by such things as XTREE, nothing jumps out
;and indicates a readable password.
;Coding of the "Prompt Strings" for the same reason
;as noted above. There is no evidence that this file
;is the one to cause the Password Check to appear on the
;screen.
code segment public 'CODE'
assume cs:code,ds:code,es:code
driver proc near
org 0 ;Required for Device Driver
;======== Driver Device Header Area ========
header: dd -1 ;One device in this file
dw 8000h ;Defines character device
dw strategy ;Pointer to install routine
dw interrupt ;pointer to proc that handles
;the services
db 'PWXYZQPR' ;8 byte string that names the
;device. Do not attempt to
;type from the Keyboard or
;anything could happen!!!!
;============================================================================
;======== Storage for header offset and segment ========
rhoffset dw 0
rhseg dw 0
;============================================================================
;============================================================================
;Area below is for some variables used by the program that installs
;PASSWORD.SYS. DO NOT change the relationship of the variable "area_length"
;to the DEVICE HEADER, or the location of the PASSWORD area! You may add
;or delete to the Screen Message area, but do not move or remove the
;"tries_left" variable in relation to the message area.
;============================================================================
area_length dw tries_left-$
password db 0
password_len equ $-password
padd db 16-password_len dup(20h)
;============================================================================
;======== Screen message character area (Encrypted) ========
msg_1 db 'Enter Password:',15 dup(20h) ;Enter Password
msg_1_len dw $-msg_1
msg_2 db '****** Password Accepted *****';Password Accepted
msg_2_len dw $-msg_2
msg_3 db '** Wrong Password Try Again **';Wrong Password
msg_3_len dw $-msg_3
msg_4 db '******** ACCESS DENIED *******';Access Denied
msg_4_len dw $-msg_4
msg_5 db 201,32 dup(205),187 ;Screen Box
msg_6 db 186,32 dup(20h),186 ;Screen Box
msg_7 db 200,32 dup(205),188 ;Screen Box
;============================================================================
;Miscellaneous Variable Storage
;============================================================================
Tries_left db 0
wordlen db 0
wordbuff db 15 dup(0)
tries db 3
breakoff dw 0
breakseg dw 0
video_location dw 0
cursor_location dw 0
;============================================================================
dummyret: iret ;Pointer to Ctrl-Break vector
;inserted by this program to
;disable the Ctrl-Break
;============================================================================
;======== main portion of program to get the user password ========
ask_password:
push cs
pop ds ;Set ds=cs
mov ax,351bh ;Get break vector (Int 1Bh)
int 21h ;from DOS
mov breakoff,bx ;Save it for later
mov breakseg,es
push cs
pop es ;Set es=cs
mov dx,offset dummyret ;Set Break vector to dummyret
mov ax,251bh
int 21h ;via DOS
check_video: ;See where video RAM is
mov ah,0fh ;via video ROM
int 10h
cmp al,07h ;See if Mono card installed
jz set_mono ;Jump to monochrome routine
mov video_location,0b800h ;If not mono then Color RAM
jmp video_done ;Exit routine
set_mono:
mov video_location,0b000h ;Set location to Mono RAM
video_done:
call clear_screen ;Self explanatory
call box ;Routine to build entry
;box on screen
xor cx,cx ;Set cx=0
mov cl,tries ;Store the number of tries
mov tries_left,cl ;for later
;======== Prompt the user for the correct password ========
set_prompt:
cmp cl,0 ;See if tries has expired
jz go_lock_out ;Jump to routine to lock
;system if tried 3 times
;with wrong password!
mov tries_left,cl ;Store the tries left
mov bx,offset msg_1 ;Point to input prompt
mov cx,msg_1_len ;Prep for display
mov ah,0fh ;Set ah with the attribute
;that write_crt uses
;You may change this for
;different colors or intensity
mov dx,0c19h ;Load dx for start location
call write_crt ;to print on CRT and write it
mov dx,0b27h ;Set CRT location for input
;field start
xor bx,bx ;Set bx to 0 (Page 0)
call position_cursor ;Set cursor to start of input
;line on CRT
mov si,offset wordlen ;Point to number of char. in
mov byte ptr [si],0 ;entry and initialize to 0
mov di,offset wordbuff ;Point to number of char. in
;stored password
;======== Character input routine ========
in_char: ;Lets go get some input
mov ah,07h ;Use none echoing input
int 21h ;from DOS
cmp al,08h ;See if backspace?
jz back_space ;Jump to routine to del Char.
cmp al,0dh ;See if input is done?
jz check_password ;Check it out
cmp byte ptr [si],15 ;See if password length has
jz bell ;been exceeded and ring bell
mov [di],al ;Store char in wordbuff and
inc di ;increment pointer
mov al,0h ;Store special char for the
call write_cursor ;display of an '*' on the CRT
jmp in_char ;Loop for the next Character
;======== Intermediate launching point to lock the machine ========
go_lock_out:
call lock_out ;Go lock up the machine
;======== Routine to back space and erase on the crt ========
back_space:
cmp byte ptr [si],0 ;See if there are no char to
jz bell ;erase and sound bell if none
dec byte ptr [si] ;Set char count to one less
dec di ;Move pointer back one in
;wordbuff
mov al,0ffh ;Set erase code for erasing
call write_cursor ;'*' at cursor position
jmp in_char ;Loop back for next char
;======== Ring the bell routine ========
Bell: mov al,07h ;Ring the bell with DOS
mov ah,0eh
int 10h
jmp in_char ;Back to input
;============================================================================
;End of input routines, now lets go check what was entered!
;============================================================================
Check_password:
mov di,offset password ;Point to length of our pre-
cmpsb ;set word and see if the
jne next_try ;length is the same and spare
;the trouble if it is not
xor cx,cx ;cx=0
mov cl,wordlen ;Total char. entered into cl
call convert_up ;Convert char. to upper case
repe cmpsb ;compare pointers si & di
cmp cl,0 ;See if all matched
je ok ;Jump to exit if they were
;Fall through if not
;======== Routine to display wrong word and reset for another word ========
next_try:
call off_screen ;Move curser out of the box
mov dx,0c19h ;Cursor location for message
mov bx,offset msg_3 ;Wrong Password message
mov cx,msg_3_len ;Message length
mov ah,8fh ;Blinking attribute
call write_crt ;Display message
mov ax,0e07h ;Ring bell
int 10h
mov ah,07h ;Ask for character input to
int 21h ;hold screen. Any char allows
;continuation of the program
mov cl,tries_left ;Set up to reduce the number
dec cl ;of tries left and go back
jmp set_prompt ;for another turn
;======== This is where we prepare to exit this program ========
ok:
call off_screen ;Move cursor out of th